<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="https://v3.bootcss.com/favicon.ico">
<title>登录</title>
<link href="/css/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="/css/page/blog.css" rel="stylesheet">
</head>

<body>
	<#include "/nav.ftl"/>

	<div class="container">
		<div class="row" style="padding-top: 20px">
			<form class="form-horizontal" id="form_signin" action="/login" method="post">
				<#if loginError??>
				<div  class="alert alert-danger col-sm-offset-2 col-sm-10" role="alert">${loginError}</div>
				</#if>
				<div class="form-group">
					<label for="ipt_username" class="col-sm-2 control-label">用户名</label>
					<div class="col-sm-10">
						<input type="text" maxlength="10" name="username" class="form-control notEmpty" id="ipt_username" placeholder="用户名">
					</div>
				</div>
				<div class="form-group">
					<label for="ipt_password" class="col-sm-2 control-label">密码</label>
					<div class="col-sm-10">
						<input type="password" maxlength="20" name="password" class="form-control notEmpty" id="ipt_password" placeholder="密码">
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
				      <div class="checkbox">
				        <label>
				          <input class="form_control" type="checkbox" id="checkbox_rememberme" value="true" name="rememberMe">记住我
				        </label>
				      </div>
				    </div>
				</div>
				
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="button" onclick="signin()" class="btn btn-lg btn-primary btn-block">登录</button>
					</div>
				</div>
			</form>
		</div>
	<!-- /container -->
	<#include "/foot.ftl"/>
	<script src="/js/jquery/jquery.min.js"></script>
	<script src="/js/bootstrap/bootstrap.min.js"></script>
	<script type="text/javascript" src="/js/bootstrap/plugins/bootbox.js"></script>
	<script type="text/javascript" src="/js/common/common.js"></script>
	<script type="text/javascript" src="/js/common/myValidation.js"></script>
	<script type="text/javascript" src="/js/basil/basil.min.js"></script>
	<script>
		var basilOption = {
			namespace : 'bm-user',
			storages : [ 'cookie', 'local' ],
			expireDays : 31,
			keyDelimiter : '.'
		};
		var basil = new window.Basil(basilOption);
		var oldUsername = basil.get("username");
		$(function(){
			$("#ipt_username").val(oldUsername);
		})
		
		function signin() {
			var validResult = myValidation.commonValid("form_signin", {
				showInfo : function(ele, mes) {
					bootbox.alert(mes);
				}
			});
			if (!validResult) {
				return;
			}
			basil.set("username", $("#ipt_username").val());
			$("#form_signin").submit();
			
		}
	</script>
</body>

</html>